package ui.prototypes;

import java.util.Calendar;

import android.app.DatePickerDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.os.Bundle;

public class DatePickerFragment extends DialogFragment {

    private final Calendar mDate;

    private final DatePickerDialog.OnDateSetListener mDateListener;

    public DatePickerFragment(Calendar date, DatePickerDialog.OnDateSetListener dateListener) {
        mDate = date;
        mDateListener = dateListener;
    }

    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        int year = mDate.get(Calendar.YEAR);
        int month = mDate.get(Calendar.MONTH);
        int day = mDate.get(Calendar.DAY_OF_MONTH);

        // Create a new instance of DatePickerDialog and return it
        return new DatePickerDialog(getActivity(), mDateListener, year, month, day);
    }

}
